import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpdickServer extends UdpEchoServer {
    private Map<String,String> dict = new HashMap<>();

    public UdpdickServer(int port) throws SocketException {
        super(port);
        dict.put("cat","小猫");
        dict.put("dog","小狗");
        dict.put("pig","小猪");
    }
    @Override
    public String process(String request){
        String responce = dict.getOrDefault(request,"词典暂无此词");
        return responce;
    }

    public static void main(String[] args) throws IOException {
        UdpdickServer server = new UdpdickServer(9090);
        server.start();
    }


}
